/**
 * 
 * @class MenuPanel
 * @extends Ext.Panel
 */
MenuPanel = Ext.extend(Ext.Panel,{
	_cur_user_id: null,
	projectManagerPanel: null,
	projectMemberPanel: null,
	guestPanel: null,
	searchPanel: null,
	systemSetting: null,
	userRole: null,
	constructor: function(config){
		Ext.apply(this,config);
		
		this.projectManagerPanel = new ProjectManagerPanel({cur_user: this._cur_user_id});
		this.projectMemberPanel = new ProjectMemberPanel({_cur_user_id: this._cur_user_id});
		this.guestPanel = new GuestPanel();
		//this.systemSetting = new SystemSetting();
		//this.searchPanel = new SearchMenuPanel();
		
		MenuPanel.superclass.constructor.call(this, {
			id: 'menu',
			region: 'west',
			split: true,
			width: 220,
			title: "专案文件管理",
			iconCls: 'cls_pdm',
			minSize: 150,
			maxSize: 300,
			border: true,
			collapsible: true,
			collapseMode: 'mini',
			margins: '0 0 0 0',
			cmargins: '0 0 0 0',		
			layout: "accordion",
			defaults: {autoScroll:true},
			layoutConfig: {
				titleCollapse: true,
				animate: true
			},
			items:[{
				title: "系统管理者专区",
				id: 'admin',
				collapsible: true,
				collapsed: !(this.userRole=="system"),
				autoScroll: false,
				border: false,
				hidden: !(this.userRole=="system"),
				iconCls: 'cls_key_admin',
				items: new AdminPanel()
			},{
				title: "专案管理员专区",
				id: 'projectManager',
				collapsible: true,
				collapsed: !(this.userRole=="project_owner"),
				border: false,
				hidden: !(this.userRole=="system"||this.userRole=="project_owner"),
				height: 220,
				iconCls: 'cls_project_admin',
				items:[this.projectManagerPanel]
			},{
				title: "专案成员专区",
				id: 'projectMember',
				collapsible: true,
				border: false,
				collapsed: !(this.userRole=="project_member"),
				hidden: !(this.userRole=="system"||this.userRole=="project_owner"||this.userRole=="project_member"),
				iconCls: 'cls_project_member',
				items: [this.projectMemberPanel]
			},{
				title: "一般人员专区",
				id: 'guest',
				collapsible: true,
				border: false,
				collapsed: !(this.userRole=="user"),
				iconCls:'cls_project_guest',
				items: [this.guestPanel]
			}
			/*,{
				title: "查询专区",
				id: 'search',
				collapsible: true,
				border: false,
				collapsed: true,
				iconCls: 'cls_search',
				items: [this.searchPanel]
			},{
				title: "系统设定",
				id: 'system_setting',
				collapsible : true,
				border: false,
				collapsed: true,
				iconCls:'cls_system_setting',
				items: [this.systemSetting]
			}*/
			]
		});
	}
});

/**
 * 系统管理员
 * @class AdminPanel
 * @extends Ext.tree.TreePanel
 */
AdminPanel = Ext.extend(Ext.tree.TreePanel, {
	constructor: function(config){
		Ext.apply(this,config);
		
		AdminPanel.superclass.constructor.call(this, {
			autoScroll: true,
			animate: true,
			id: 'tAdminPanel',
			border: false,
			bodyStyle: 'padding:5 5 5 5',
			rootVisible: false,
			contextMenu: new Ext.menu.Menu({
				items: [{
					text: "Get ID"
				}],
				listeners: {
					itemclick: function(item) {
						/*
						switch (item.id) {
							case 'delete-node':
								var n = item.parentMenu.contextNode;
								if (n.parentNode) {
									alert(n.id);
								}
								break;
						}
						*/
					}
				}
			}),
			listeners: {
				contextmenu: function(node, e){
					/*
					node.select();
					var c = node.getOwnerTree().contextMenu;
					c.contextNode = node;
					c.showAt(e.getXY());
					*/
				}
			}
		});
		
		var root = new Ext.tree.AsyncTreeNode({
							text: "系统管理者专区",
							draggable: false,
							expanded: true,
							children: [{
								text: "专案管理",
								iconCls: 'cls_project_maintenance',
								id: 'tEditProjectManager',
								leaf: true
							},{
								text: "专案模板管理",
								iconCls: 'cls_edit_category',
								id: 'tEditProjectModel',
								leaf: true
							},{
								id: 'tPageAttrSetting',
								text: "页面样式管理",
								iconCls: 'cls_pages_attr',
								qtip: "创建、设置页面样式",
								leaf: true
							},{
								id: 'tDocTmplSetting',
								text: "文档表单样式设定",
								iconCls: 'cls_doc_tmpl_setting',
								qtip: "设定具体表单的页面样式",
								leaf: true
							},{
								id: 'tRoleSetting',
								text: "职务管理",
								iconCls: 'cls_role_management',
								qtip: "创建、管理职务，设定职务的默认人员等",
								leaf: true
							}]
						});
		this.setRootNode(root);
		
		this.on('click', function(node){
			var objTabs = Ext.getCmp('tabs');
			
			if(node.id=='tEditProjectModel'){
				var objModelTab = Ext.getCmp("model_tab");
				if(typeof(objModelTab)=='undefined'){
					var tp_category_model = Ext.getCmp("tp_category_model");
					if(typeof(tp_category_model)=='undefined')
					{
					  	tp_category_model = new CategoryModelTreeGrid();
					}
					/*
					var treeEditer = new Ext.tree.TreeEditor(tp_category_model, {allowBlank: false, ignoreNoChange: true});
					
					treeEditer.on('beforecomplete', function(editor, newValue, originalValue)
					{
						Ext.Ajax.request({
							method: 'post',
							url: '/pdm/category/autoSaveNodeInfo.htm',
							params: {
								nodeid: editor.editNode.id,
								newValue: newValue,
								originalValue: originalValue
							},
							success: function(response,options){
								
							},
							failure: function(response){
								return false;
							}
						});
					});
					*/
					objTabs.add({
						id: 'model_tab',
						title: "专案模板管理",
						region: 'center',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						border: false,
						iconCls: 'cls_edit_category',
						items: [tp_category_model]
					});
					objTabs.getLayout().setActiveItem("model_tab");
					objTabs.doLayout();
				}
				else objModelTab.show();
			}
			else if(node.id == 'tNewProject'||node.id == 'tEditProjectManager'){
								
				var objProjectMainTab = Ext.getCmp("project_maintenance_tab");
				if(typeof(objProjectMainTab)=='undefined'){
					var project_tree_grid = Ext.getCmp("project_tree_grid");
					if(typeof(tp_category_model)=='undefined')
					{
					  	project_tree_grid = new ProjectTreeGrid();
					}
	
					objTabs.add({
						id: 'project_maintenance_tab',
						title: "专案管理",
						region: 'center',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						border: false,
						iconCls: 'cls_project_maintenance',
						items: [project_tree_grid]
					});
					objTabs.getLayout().setActiveItem("project_maintenance_tab");
					objTabs.doLayout();
					
					/*
					*  等待tab渲染完毕后载入表格树中的数据，可见loading效果；
					*/
					var loadMask = new Ext.LoadMask(project_tree_grid.el, {
						msg: "信息载入中，请稍后...",
						removeMask: true
					});
					loadMask.show();
									
					project_tree_grid.root.on("load", function(node){
						loadMask.hide();
					});
					
				}else{
					objProjectMainTab.show();
				}				
			}
			else if(node.id=='tAllProjectSearch' ){
				var objAllProjectTab = Ext.getCmp("all_doc_list_tab");
				if(typeof(objAllProjectTab)=='undefined'){
					var pnl_allProject = Ext.getCmp("allProjectPanel");
					if(typeof(pnl_allProject)=='undefined')
					{
					  	pnl_allProject = new Ext.Panel({
							id: 'allProjectPanel',
							border: false,
							layout: 'fit',
							autoScroll: true,
							items:[new ProjectList()],
							tbar:["<b><font color=#15428B>IVO新产品开发文件总览表</font></b>",'->',{
								text: "刷新",
								scope: this,
								iconCls: "cls_table_refresh",
								tooltip: "刷新下列窗口中的数据",
								handler: function(){
									var allProjectList = Ext.getCmp("allProjectList");
									allProjectList.root.reload(true,true);
								}
							}]
						});
					}
					objTabs.add({
						title: "文档总览表",
						id: 'all_doc_list_tab',
						region: 'center',
						iconCls: 'cls_all_document_list',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						border: false,
						items:[pnl_allProject]
					});
					objTabs.getLayout().setActiveItem("all_doc_list_tab");
					objTabs.doLayout();
				}else{
					objAllProjectTab.show();
				}
			}
			else if(node.id == 'tPageAttrSetting'){
				window.open("/pdm/admin.htm?method=designTmpl","_blank","resizable=yes, scrollbars=yes, status=yes");
				return false;
			}
			else if(node.id == 'tRoleSetting'){
				var objRoleSettingTab = Ext.getCmp("role_member_setting_tab");
				if(typeof(objRoleSettingTab)=='undefined'){
					
					var roleSetting_grid = Ext.getCmp("templateGrid");
					if(typeof(roleSetting_grid)=='undefined')
					{
					  	roleSetting_grid = new RoleSettingPanel({id:"roleSettingGrid"});
					}
					objTabs.add({
						id: 'role_member_setting_tab',
						title: "职务管理",
						iconCls: 'cls_role_management',
						region: 'center',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						border: false,
						items: [roleSetting_grid]
					});
					objTabs.getLayout().setActiveItem("role_member_setting_tab");
					objTabs.doLayout();
					/*
					*  等待tab渲染完毕后载入表格中的数据，可见loading效果；
					*/
					roleSetting_grid.load();
				}else{
					objRoleSettingTab.show();
				}
			}
			else if(node.id == 'tDocTmplSetting'){
				var objDocTmplSettingTab = Ext.getCmp("doc_template_setting_tab");
				if(typeof(objDocTmplSettingTab)=='undefined'){
					
					var docTmplSetting_grid = Ext.getCmp("sheetTemplate_tree_grid");
					if(typeof(docTmplSetting_grid)=='undefined')
					{
					  	docTmplSetting_grid = new SheetTemplateTreeGrid();
					}
					
					objTabs.add({
						id: 'doc_template_setting_tab',
						title: "文档模板设定",
						iconCls: 'cls_doc_tmpl_setting',
						region: 'center',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						items: [docTmplSetting_grid]
					});
					objTabs.getLayout().setActiveItem("doc_template_setting_tab");
					objTabs.doLayout();
				}else{
					objDocTmplSettingTab.show();
				}
			}
		});
		
	}
});

/**
 * 
 * @class ProjectManagerPanel
 * @extends Ext.tree.TreePanel
 */
ProjectManagerPanel = Ext.extend(Ext.tree.TreePanel, {
	cur_user: null,
	constructor: function(config){
		Ext.apply(this,config);
		
		ProjectManagerPanel.superclass.constructor.call(this, {
			autoScroll: true,
			animate: true,
			id: 'tProjectManager',
			border: false,
			bodyStyle: 'padding:5px 5px 5px',
			rootVisible: false,
			contextMenu: new Ext.menu.Menu({
				items: [{
					//id: 'delete-node',
					text: 'Get ID'
				}],
				listeners: {
					itemclick: function(item) {
						switch (item.id) {
							case 'delete-node':
								var n = item.parentMenu.contextNode;
								if (n.parentNode) {
									alert(n.id);
								}
								break;
						}
					}
				}
			}),
			listeners: {
				contextmenu: function(node, e){
					node.select();
					var c = node.getOwnerTree().contextMenu;
					c.contextNode = node;
					c.showAt(e.getXY());
				}
			}
		});
		var root = new Ext.tree.AsyncTreeNode({
							text: "专案管理者专区",
							draggable: false,
							expanded: true,
							children: [{
								text: "我的专案管理",
								iconCls: 'cls_project_search',
								id: 'tMyProjectSearch',
								leaf: true
							},{
								text: "成员维护表",
								iconCls: 'cls_members_maintenance',
								id: 'tMemberMaintenance',
								leaf: true
							}]
						});
		this.setRootNode(root);
		
		/*this.root.appendChild(new Ext.tree.TreeNode({
			text : "我的未完成文件",
			iconCls:'cls_project_onhand',
			id : 'tOnhand'
		}));
		this.root.appendChild(new Ext.tree.TreeNode({
			text: "文档总览表",
			iconCls: 'cls_all_document_list',
			id: 'tAllProjectSearch'
		}));
		*/
		this.on('click', function(node){
			var objTabs = Ext.getCmp('tabs');
			
			if(node.id=='tMyProjectSearch' ){
				var objMyProjectSearchTab = Ext.getCmp("my_project_tab");
				if(typeof(objMyProjectSearchTab)=='undefined'){
					var pnl_myProject = Ext.getCmp("my_project_tree_grid");
					if(typeof(pnl_myProject)=='undefined')
					{
					  	pnl_myProject = new MyProjectTreeGrid({userId: this.cur_user});
					}
					objTabs.add({
						title: "我的专案管理",
						id: 'my_project_tab',
						region: 'center',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						border: false,
						iconCls: 'cls_project_search',
						items: [pnl_myProject]
					});
					objTabs.getLayout().setActiveItem("my_project_tab");
					objTabs.doLayout();
					
					/*
					*  等待tab渲染完毕后载入表格树中的数据，可见loading效果；
					*/
					var loadMask = new Ext.LoadMask(pnl_myProject.el, {
						msg: "信息载入中，请稍后...",
						removeMask: true
					});
					loadMask.show();
									
					pnl_myProject.root.on("load", function(node){
						loadMask.hide();
					});
				}
				else objMyProjectSearchTab.show();
			}else if(node.id=='tMemberMaintenance' ){
				var objMainMemberTab = Ext.getCmp("member_maintenance_tab");
				if(typeof(objMainMemberTab)=='undefined'){
					var gpMemberMaintenance = Ext.getCmp("gpMemberMaintenance");
					if(typeof(gpMemberMaintenance)=='undefined')
					{
					  	gpMemberMaintenance = new MemberMaintenancePanel({id:'gpMemberMaintenance'});
					}
					objTabs.add({
						id: 'member_maintenance_tab',
						title: "成员维护表",
						region: 'center',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						border: false,
						iconCls: 'cls_members_maintenance',
						items: [gpMemberMaintenance]
					});
					objTabs.getLayout().setActiveItem("member_maintenance_tab");
					objTabs.doLayout();
				}
				else objMainMemberTab.show();
			}
			else if(node.id=='tAllProjectSearch' ){
				var objAllProjectTab = Ext.getCmp("all_doc_list_tab");
				if(typeof(objAllProjectTab)=='undefined'){
					var pnl_allProject = Ext.getCmp("allProjectPanel");
					if(typeof(pnl_allProject)=='undefined')
					{
					  	pnl_allProject = new Ext.Panel({
							id: 'allProjectPanel',
							border: false,
							layout: 'fit',
							autoScroll: true,
							items:[new ProjectList()],
							tbar:["<b><font color=#15428B>IVO新产品开发文件总览表</font></b>",'->',{
								text: "刷新",
								scope: this,
								iconCls: "cls_table_refresh",
								tooltip: "刷新下列窗口中的数据",
								handler: function(){
									var allProjectList = Ext.getCmp("allProjectList");
									allProjectList.root.reload(true,true);
								}
							}]
						});
					}
					objTabs.add({
						title: "文档总览表",
						id: 'all_doc_list_tab',
						region: 'center',
						iconCls: 'cls_all_document_list',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						border: false,
						items:[pnl_allProject]
					});
					objTabs.getLayout().setActiveItem("all_doc_list_tab");
					objTabs.doLayout();
				}else{
					objAllProjectTab.show();
				}
			}
			
		});
	}
});

/**
 * 
 * @class ProjectMemberPanel
 * @extends Ext.tree.TreePanel
 */
ProjectMemberPanel = Ext.extend(Ext.tree.TreePanel, {
	_cur_user_id: null,
	constructor: function(config){
		Ext.apply(this,config);
		
		ProjectMemberPanel.superclass.constructor.call(this, {
			autoScroll : true,
			animate : true,
			id : 'tProjectMember',
			border : false,
			bodyStyle: 'padding:5 5 5 5',
			rootVisible : false,
			root : new Ext.tree.TreeNode({
				text : "专案成员专区",
				draggable : false,
				expanded : true
			}),
			contextMenu: new Ext.menu.Menu({
				items: [{
					//id: 'delete-node',
					text: 'Get ID'
				}],
				listeners: {
					itemclick: function(item) {
						switch (item.id) {
							case 'delete-node':
								var n = item.parentMenu.contextNode;
								if (n.parentNode) {
									alert(n.id);
								}
								break;
						}
					}
				}
			}),
			listeners: {
				contextmenu: function(node, e){
					node.select();
					var c = node.getOwnerTree().contextMenu;
					c.contextNode = node;
					c.showAt(e.getXY());
				}
			}
		});
		
		this.root.appendChild(new Ext.tree.TreeNode({
			text : "我的负责文件查询",
			iconCls: 'cls_my_document',
			id : 'tMyOwnFileSearch'
		}));
		/*
		this.root.appendChild(new Ext.tree.TreeNode( {
			text : "修改文件资料",
			iconCls: 'cls_maintain_document',
			id : 'tEditProjectFiles'
		}));
		*/
		this.root.appendChild(new Ext.tree.TreeNode({
			text: "我的未完成文件",
			iconCls: 'cls_unfinished_document',
			id: 'tDocumentOnhand'
		}));
		
		this.on('click', function(node){
			var objTabs = Ext.getCmp('tabs');
			
			if(node.id=='tMyOwnFileSearch' )
			{
				var objMyOwnFileSearchTab = Ext.getCmp("my_own_file_tab");
				if(typeof(objMyOwnFileSearchTab)=='undefined'){
					var pnl_myOwnFile = Ext.getCmp("myOwnDocumentGrid");
					if(typeof(pnl_myOwnFile)=='undefined')
					{
					  	pnl_myOwnFile = new MyOwnDocument({id: "myOwnDocumentGrid", _cur_user_id: this._cur_user_id, _unfinished: false});
					}
					objTabs.add({
						title: "我的负责文件查询",
						id: 'my_own_file_tab',
						region: 'center',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						border: false,
						iconCls: 'cls_my_document',
						items: [pnl_myOwnFile]
					});
					objTabs.getLayout().setActiveItem("my_own_file_tab");
					objTabs.doLayout();
					
					if(this._cur_user_id!=null) pnl_myOwnFile.load(this._cur_user_id);
				}else{
					objMyOwnFileSearchTab.show();
				}
			}else if(node.id=='tDocumentOnhand' ){
				var objMyOnhandFileSearchTab = Ext.getCmp("my_onhand_file_tab");
				if(typeof(objMyOnhandFileSearchTab)=='undefined'){
					var pnl_myOnhandFile = Ext.getCmp("myOnhandDocumentGrid");
					if(typeof(pnl_myOnhandFile)=='undefined')
					{
					  	pnl_myOnhandFile = new MyOwnDocument({id: "myOnhandDocumentGrid", _cur_user_id: this._cur_user_id, _unfinished: true});
					}
					objTabs.add({
						title: "我的未完成文件",
						id: 'my_onhand_file_tab',
						region: 'center',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						border: false,
						iconCls: 'cls_unfinished_document',
						items: [pnl_myOnhandFile]
					});
					objTabs.getLayout().setActiveItem("my_onhand_file_tab");
					objTabs.doLayout();
					
					if(this._cur_user_id!=null) pnl_myOnhandFile.load(this._cur_user_id);
				}else{
					objMyOnhandFileSearchTab.show();
				}
			}
		});
	}
});

/** =======================================================
 *  GuestPanel.js
 ** ==================================================== */
GuestPanel = Ext.extend(Ext.tree.TreePanel, {
	constructor: function(config){
		Ext.apply(this,config);
		
		GuestPanel.superclass.constructor.call(this, {
			autoScroll : true,
			animate : true,
			id : 'tGuestMenu',
			border: false,
			bodyStyle: 'padding:5 5 5 5',
			rootVisible : false,
			root : new Ext.tree.TreeNode( {
				text : "一般人员专区",
				draggable : false,
				expanded : true
			})
		});
		
		this.root.appendChild(new Ext.tree.TreeNode({
			text: "文档总览表",
			iconCls: 'cls_all_document_list',
			id: 'tAllProjectSearch'
		}));
		/*
		this.root.appendChild(new Ext.tree.TreeNode({
			text: "一般查询",
			iconCls: 'cls_common_research',
			id: 'tCommonSearch'
		}));
		*/
		this.root.appendChild(new Ext.tree.TreeNode({
			text: "文档查询",
			iconCls: 'cls_fuzzy_research',
			id: 'tFuzzySearch'
		}));
		
		this.on('click', function(node){
			var objTabs = Ext.getCmp('tabs');
			if(node.id=='tAllProjectSearch' )
			{
				var objAllProjectTab = Ext.getCmp("all_doc_list_tab");
				if(typeof(objAllProjectTab)=='undefined')
				{
					var pnl_allProject = Ext.getCmp("allProjectPanel");
					if(typeof(pnl_allProject)=='undefined')
					{
					  	pnl_allProject = new Ext.Panel({
							id: 'allProjectPanel',
							border: false,
							layout: 'fit',
							autoScroll: true,
							items:[new ProjectList()],
							tbar:["<b><font color=#15428B>IVO新产品开发文件总览表</font></b>",'->',{
								text: "刷新",
								scope: this,
								iconCls: "cls_table_refresh",
								tooltip: "刷新下列窗口中的数据",
								handler: function(){
									var allProjectList = Ext.getCmp("allProjectList");
									allProjectList.root.reload(true,true);
								}
							}]
						});
					}
					objTabs.add({
						title: "文档总览表",
						id: 'all_doc_list_tab',
						region: 'center',
						iconCls: 'cls_all_document_list',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						border: false,
						items:[pnl_allProject]
					});
					objTabs.getLayout().setActiveItem("all_doc_list_tab");
					objTabs.doLayout();
				}else{
					objAllProjectTab.show();
				}
			}
			/*
			else if(node.id=='tCommonSearch' ){
				var objDocSearchTab = Ext.getCmp("doc_search_tab");
				if(typeof(objDocSearchTab)=='undefined'){
					var pnl_docSearch = Ext.getCmp("docSearchPanel");
					if(typeof(pnl_docSearch)=='undefined')
					{
					  	pnl_docSearch = new DocSearchPanel();
					}
					objTabs.add({
						id: 'doc_search_tab',
						title: "一般查询",
						region: 'center',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						border: false,
						iconCls: 'cls_common_research',
						items: [pnl_docSearch]
					});
					objTabs.getLayout().setActiveItem("doc_search_tab");
					objTabs.doLayout();
				}else{
					objDocSearchTab.show();
				}
			}
			*/
			else if( node.id=='tFuzzySearch' )
			{
				var objAdvanSearchTab = Ext.getCmp("advance_search_tab");
				if(typeof(objAdvanSearchTab)=='undefined'){
					var pnl_advancedSearch = Ext.getCmp("advanceSearchPanel");
					if(typeof(pnl_advancedSearch)=='undefined')
					{
					  	pnl_advancedSearch = new AdvanceSearchPanel();
					}
					objTabs.add({
						id: 'advance_search_tab',
						title: "文档查询",
						region: 'center',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						border: false,
						iconCls: 'cls_fuzzy_research',
						items: [pnl_advancedSearch]
					});
					objTabs.getLayout().setActiveItem("advance_search_tab");
					objTabs.doLayout();
				}else{
					objAdvanSearchTab.show();
				}
			}
		});
	}
});
/** =======================================================
 *  SearchMenuPanel.js
 ** ==================================================== */
SearchMenuPanel = Ext.extend(Ext.tree.TreePanel, {
	constructor: function(config){
		Ext.apply(this,config);
		
		SearchMenuPanel.superclass.constructor.call(this, {
			autoScroll: true,
			animate: true,
			id: 'tSearchMenu',
			border: false,
			bodyStyle: 'padding:5px 5px 0',
			rootVisible: false,
			root: new Ext.tree.TreeNode({
				text: "查询专区",
				draggable: false,
				expanded: true
			})
		});
		
		this.root.appendChild(new Ext.tree.TreeNode( {
			text: "一般查询",
			iconCls: 'cls_common_research',
			id: 'tCommonSearch'
		}));
		this.root.appendChild(new Ext.tree.TreeNode( {
			text: "高级查询",
			iconCls: 'cls_fuzzy_research',
			id: 'tFuzzySearch'
		}));
		
		this.on('click', function(node){
			var objTabs = Ext.getCmp('tabs');
			
			if(node.id=='tCommonSearch' ){
				var objDocSearchTab = Ext.getCmp("doc_search_tab");
				if(typeof(objDocSearchTab)=='undefined'){
					var pnl_docSearch = Ext.getCmp("docSearchPanel");
					if(typeof(pnl_docSearch)=='undefined')
					{
					  	pnl_docSearch = new DocSearchPanel();
					}
					objTabs.add({
						id: 'doc_search_tab',
						title: "一般查询",
						region: 'center',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						border: false,
						iconCls: 'cls_common_research',
						items: [pnl_docSearch]
					});
					objTabs.getLayout().setActiveItem("doc_search_tab");
					objTabs.doLayout();
				}else{
					objDocSearchTab.show();
				}
			}
			else if(node.id=='tFuzzySearch' ){
				var objAdvanSearchTab = Ext.getCmp("advance_search_tab");
				if(typeof(objAdvanSearchTab)=='undefined'){
					var pnl_advancedSearch = Ext.getCmp("advanceSearchPanel");
					if(typeof(pnl_advancedSearch)=='undefined')
					{
					  	pnl_advancedSearch = new AdvanceSearchPanel();
					}
					objTabs.add({
						id: 'advance_search_tab',
						title: "高级查询",
						region: 'center',
						closable: true,
						layout: 'fit',
						border: false,
						frame: false,
						border: false,
						iconCls: 'cls_fuzzy_research',
						items: [pnl_advancedSearch]
					});
					objTabs.getLayout().setActiveItem("advance_search_tab");
					objTabs.doLayout();
				}else{
					objAdvanSearchTab.show();
				}
			}
		});
	}
});
/** =======================================================
 *  SystemSetting.js
 ** ==================================================== */
SystemSetting = Ext.extend(Ext.tree.TreePanel, {
	constructor: function(config){
		Ext.apply(this,config);
		
		SystemSetting.superclass.constructor.call(this, {
			autoScroll: true,
			animate: true,
			id: 'tSystemSetting',
			border: false,
			bodyStyle: 'padding:5px 5px 0',
			rootVisible: false,
			root: new Ext.tree.TreeNode({
				text: "系统设定",
				draggable: false,
				expanded: true
			})
		});
		
		this.root.appendChild(new Ext.tree.TreeNode({
			text: "设置欢迎窗口",
			iconCls: 'cls_welcome',
			id: 'tWelcome'
		}));
		
		this.root.appendChild(new Ext.tree.TreeNode({
			text: "语言设定",
			iconCls: 'cls_language_setting',
			id: 'tLanguage'
		}));
	}
});

	